<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * 定义捕获器
         **/
         
         // get() 捕获器
         const target = {
            name: 'xiaomi'
         }

         const handler = {
            // 只有在代理对象上指向get操作才会触发
            get() {
                return 'hanler override'
            }
         }

         const proxy = new Proxy(target, handler)

         console.log(target.name) // xiaomi, 操作的是目标对象
         console.log(proxy.name) // handler override 操作的是代理对象
         
    </script>
</body>
</html>